#LD := ld -m elf_x86_64
USE_DEBUG :=
GCC := gcc
#CCFLAG := -mcpu=i386 -I../include -nostdinc -Wall -fomit-frame-pointer -c -m32
CCFLAG := -I../../include -nostdinc -ffreestanding -Wall -fomit-frame-pointer -fno-pic -fno-stack-protector -c -m32 $(USE_DEBUG)
#LDFLAG := -Ttext 0x0 -s --oformat binary -m elf_i386
#LDFLAG := -s --oformat binary -m elf_i386
LDFLAG := -r -m elf_i386
OBJS := io.o asm.o

asm : $(OBJS)
	$(LD) $(LDFLAG) -o $@ $^

io.o : io.S
	$(GCC) -m32 -traditional -c -o $@ $<

asm.o : asm.S
	$(GCC) -m32 -traditional -c -o $@ $<

clean :
	rm -f *.o
	rm -f asm
